<!DOCTYPE html>
<html lang="en">
{% include 'head.html' %}
<body>
	{% include 'navbar.html' %}
	{% include 'header.html' %}
	{% if success %}
		<table class="table table-striped">
		{% for movie, bool in old_movies %}
			{% if forloop.first %}
				<tr>
					<th class="span5">{{old_movies|length}} Existing Titles</th>
					<th class="span1"></th>
					<th class="span2"></th>
				</tr>
			{% endif %}
			<tr>
				{% url movies.views.view_movie urltitle=movie.UrlTitle as movie_url %}
				<td><a href="{{movie_url}}">{{movie.Title}}</a></td>
				<td style="text-align: center">{{movie.Year}}</td>
				<td style="text-align: center">
					{% if bool %}
						<a class="btn btn-small btn-success" href="{{movie_url}}">Options</a>
					{% else %}
						<a class="btn btn-small btn-success" href="{{movie_url}}?assoc=1&add=1&seen=1">Seen</a>
						&nbsp&nbsp&nbsp
						<a class="btn btn-small btn-success" href="{{movie_url}}?assoc=1&add=1">Want</a>
					{% endif %}
				</td>
			</tr>
		{% endfor %}
		{% url movies.views.view_movies as movies_url %}
		{% for movie in new_movies %}
			{% if forloop.first %}
				<tr>
					<th class="span5">{{new_movies|length}} New Titles</th>
					<th class="span1"></th>
					<th class="span2"></th>
				</tr>
			{% endif %}
			<tr>
				<td><a href="{{movie.UrlTitle}}" target="_blank">{{movie.Title}}</a></td>
				<td style="text-align: center">{{movie.Year}}</td>
				<td style="text-align: center">
					{% if movie.NetflixId and movie.RottenTomatoesId %}
						<a class="btn btn-small btn-warning" href="{{movies_url}}?add=1&i={{movie.ImdbId}}&n={{movie.NetflixId}}&r={{movie.RottenTomatoesId}}&seen=1">Seen</a>
					{% elif movie.NetflixId %}
						<a class="btn btn-small btn-warning" href="{{movies_url}}?add=1&i={{movie.ImdbId}}&n={{movie.NetflixId}}&seen=1">Seen</a>
					{% elif movie.RottenTomatoesId %}
						<a class="btn btn-small btn-warning" href="{{movies_url}}?add=1&i={{movie.ImdbId}}&r={{movie.RottenTomatoesId}}&seen=1">Seen</a>
					{% else %}
						<a class="btn btn-small btn-warning" href="{{movies_url}}?add=1&i={{movie.ImdbId}}&seen=1">Seen</a>
					{% endif %}
					&nbsp&nbsp&nbsp
					{% if movie.NetflixId and movie.RottenTomatoesId %}
						<a class="btn btn-small btn-warning" href="{{movies_url}}?add=1&i={{movie.ImdbId}}&n={{movie.NetflixId}}&r={{movie.RottenTomatoesId}}">Want</a>
					{% elif movie.NetflixId %}
						<a class="btn btn-small btn-warning" href="{{movies_url}}?add=1&i={{movie.ImdbId}}&n={{movie.NetflixId}}">Want</a>
					{% elif movie.RottenTomatoesId %}
						<a class="btn btn-small btn-warning" href="{{movies_url}}?add=1&i={{movie.ImdbId}}&r={{movie.RottenTomatoesId}}">Want</a>
					{% else %}
						<a class="btn btn-small btn-warning" href="{{movies_url}}?add=1&i={{movie.ImdbId}}">Want</a>
					{% endif %}
				</td>
			</tr>
		{% endfor %}
		</table>
		{% if length < 20 %}
			<a href="{{request.get_full_path}}&length={{length|add:3}}">+ More Results</a>
		{% endif %}
	{% else %}
		{% for item in results.items %}
			<div class="alert alert-error">
				{{item.1}}
			</div>
		{% endfor %}
	{% endif %}
	{% include 'footer.html' %}
</body>
</html>